﻿@model IEnumerable<MvcExamples.Models.OrderDetail>

@{
    ViewBag.Title = "Index";
   
}

 @if (Model.Count() > 0)
 {
     var order = Model.First().Order;
    
<fieldset>
        <legend>THÔNG TIN KHÁCH HÀNG</legend>
        <div class="editor-label">
            @Html.LabelFor(model => order.Name)
        </div>
        <div class="display-field">
            @Html.DisplayFor(model => order.Name)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => order.Address)
        </div>
        <div class="display-field">
            @Html.DisplayFor(model => order.Address)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => order.Date)
        </div>
        <div class="display-field">
            @Html.DisplayFor(model => order.Date)
        </div>
    </fieldset>
 }
 <table>
@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Product.Code)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ProductUnit.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Order.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Amount)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Price)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.TotalDetailAmount)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.OrderDetailId }) |
            @Html.ActionLink("Details", "Details", new { id=item.OrderDetailId }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.OrderDetailId })
        </td>
    </tr>
}

</table>
